package com.lingdian.study.aop;

import java.lang.reflect.Method;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;



public class CglibProxy implements MethodInterceptor{
	private Enhancer enhancer = new Enhancer();

	public Object getProxy(Class clazz){
		enhancer.setSuperclass(clazz);
		enhancer.setCallback(this);
		return enhancer.create();
	}

	@Override
	public Object intercept(Object arg0, Method arg1, Object[] arg2,
			MethodProxy proxy) throws Throwable {
		 System.out.println("please show your tickes");
		return proxy.invokeSuper(arg0, arg2);
	}

	
}
